package com.marvels.approve.loan.api.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.marvels.approve.common.dto.InsurancePolicyDTO;
import com.marvels.approve.loan.api.LoanApplyProvideApi;
import com.marvels.approve.loan.dao.IMcamLoanApplyInfoDao;
import com.marvels.approve.loan.dao.McamLoanApplyContactInfoMapper;
import com.marvels.approve.loan.dao.McamLoanInsurancePolicyInfoMapper;
import com.marvels.approve.loan.dto.McamLoanApplyContactInfo;
import com.marvels.approve.loan.dto.McamLoanApplyInfoDTO;
import com.marvels.approve.loan.dto.WaitLendInfoDTO;
import com.marvels.approve.process.dao.ContractTemplateDao;
import com.marvels.approve.process.dto.ProtocolTemplateInfoDTO;

@Service
public class LoanApplyProvideImpl implements LoanApplyProvideApi{

	@Autowired
	private ContractTemplateDao contractTemplateDao;
	
	@Autowired
	private IMcamLoanApplyInfoDao iMcamLoanApplyInfoDao;
	
	@Autowired
	private McamLoanApplyContactInfoMapper mcamLoanApplyContactInfoMapper;
	
	@Autowired
	private McamLoanInsurancePolicyInfoMapper mcamLoanInsurancePolicyInfoMapper;
	
	@Override
	public int modifyLoanApplyInfo(McamLoanApplyInfoDTO mcamLoanApplyInfoDTO) {
		
		return iMcamLoanApplyInfoDao.updateByLoanId(mcamLoanApplyInfoDTO);
	}

	@Override
	public McamLoanApplyInfoDTO selectLoanApplyInfo(McamLoanApplyInfoDTO mcamLoanApplyInfoDTO) {
		return iMcamLoanApplyInfoDao.selectMcamLoanApplyInfoByLoanId(mcamLoanApplyInfoDTO.getLoanId());
	}

	@Override
	public List<McamLoanApplyContactInfo> selectContactByLoanId(McamLoanApplyContactInfo mcamLoanApplyContactInfo) {
		return mcamLoanApplyContactInfoMapper.selectByLoanId(mcamLoanApplyContactInfo.getLoanId());
	}

	@Override
	public List<InsurancePolicyDTO> selectInsuranceByLoanId(InsurancePolicyDTO mcamLoanInsurancePolicyInfo) {
		return mcamLoanInsurancePolicyInfoMapper.selectInsuranceByLoanId(mcamLoanInsurancePolicyInfo.getLoanId());
	}

	@Override
	public List<String> selectWaitLendInfo(WaitLendInfoDTO infoDTO) {
		return iMcamLoanApplyInfoDao.selectWaitLendInfo(infoDTO);
	}

	@Override
	public List<ProtocolTemplateInfoDTO> findProtocalTemplateList(McamLoanApplyInfoDTO dto) {

		return contractTemplateDao.findProtocalTemplateList(dto);
	}

	@Override
	public Map<String, Object> selectShzxNeedLoanApplyInfo(McamLoanApplyInfoDTO mcamLoanApplyInfoDTO) {
		Map<String, Object> map=iMcamLoanApplyInfoDao.selectShzxNeedLoanApplyInfo(mcamLoanApplyInfoDTO);
		return map;
	}
	
}
